﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ZGRemote.Client.Utils
{
    public class SingleInstanceMutexUtil
    {
        private static Mutex instanceMutex;

        public static bool CreateInstanceMutex(string name)
        {
            var instance = new Mutex(false, $"Local\\{name}",out bool createNew);
            if (createNew)
            {
                instanceMutex = instance;
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
